Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Handle bad setState #357

Merged
merged 1 commit into from
Mar 26, 2024
Merged

fix: Handle bad setState #357

merged 1 commit into from
Mar 26, 2024

Conversation

Xavier-Charles
Copy link
Contributor

Moving the setState out of the effect created an infinite loop. This fixes that.

@Xavier-Charles Xavier-Charles marked this pull request as ready for review March 26, 2024 12:23
prevIsSavingProfile === true &&
isSavingProfile === false &&
isProfileUpdated === false
) {
setIsProfileUpdated(true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find it more readable to use the typical pattern were you do:

if (prevIsSavingProfile === true && isSavingProfile === false) {
  setIsProfileUpdated(true);
  prevIsSavingProfile.current - false
 }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find it more readable to use the typical pattern were you do:
prevIsSavingProfile is of type boolean

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what?

@v-almonacid v-almonacid merged commit 74c364c into dev Mar 26, 2024
1 check passed
@v-almonacid v-almonacid deleted the fix/handle-too-many-rerenders branch March 26, 2024 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants